/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "parcel.h"

namespace OHOS::FileAccessFwk {
bool Parcel::WriteInt32(int32_t value)
{
    if (IParcel::parcel_ == nullptr) {
        GTEST_LOG_(INFO) << "Parcel::WriteInt32 parcel_ is nullptr";
        return false;
    }
    return IParcel::parcel_->WriteInt32(value);
}

bool Parcel::ReadInt32(int32_t &value)
{
    if (IParcel::parcel_ == nullptr) {
        GTEST_LOG_(INFO) << "Parcel::ReadInt32 parcel_ is nullptr";
        return false;
    }
    return IParcel::parcel_->ReadInt32(value);
}

bool Parcel::WriteUint32(uint32_t value)
{
    if (IParcel::parcel_ == nullptr) {
        GTEST_LOG_(INFO) << "Parcel::WriteUint32 parcel_ is nullptr";
        return false;
    }
    return IParcel::parcel_->WriteUint32(value);
}

bool Parcel::ReadUint32(uint32_t &value)
{
    if (IParcel::parcel_ == nullptr) {
        GTEST_LOG_(INFO) << "Parcel::ReadUint32 parcel_ is nullptr";
        return false;
    }
    return IParcel::parcel_->ReadUint32(value);
}

bool Parcel::WriteString(const std::string &value)
{
    if (IParcel::parcel_ == nullptr) {
        GTEST_LOG_(INFO) << "Parcel::WriteString parcel_ is nullptr";
        return false;
    }
    return IParcel::parcel_->WriteString(value);
}

bool Parcel::ReadString(std::string &value)
{
    if (IParcel::parcel_ == nullptr) {
        GTEST_LOG_(INFO) << "Parcel::ReadString parcel_ is nullptr";
        return false;
    }
    return IParcel::parcel_->ReadString(value);
}
} // namespace OHOS::FileAccessFwk